<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>UMD Room Finder</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
        body
        { 
        background-color:#e5f5ff;
        background-image:url(http://img.photobucket.com/albums/v627/lovkurama/Screenshot2011-10-03at53227PM.png);
        background-repeat:repeat-x;
        }
        div.banner
        {
        text-align:left;
        }
    </style>

  </head>
  <body>


<div class="banner">

<img src="http://img.photobucket.com/albums/v627/lovkurama/Screenshot2011-10-11at103904AM.png" height=30>


<h1>Room Finder</h1>
<br>

Destination:
<h5>Building:</h5>

<?php
	//make connection to server
	$link = mysql_connect('localhost', 'pott0180', 'ckersixt');
	if(!$link) {
		die('Could not connect: ' . mysql_error());
	}

	//select database
	$db_selected = mysql_select_db('soloono_roomFinder', $link);
	if (!$db_selected) {
		die('Cant use db soloono_roomFinder: ' . mysql_error());
	}

        //declare variables
	$building_result = sprintf("SELECT name FROM Building");
        $building_query = mysql_query($building_result);

        $room_result = sprintf("SELECT number FROM Room");
        $room_query = mysql_query($room_result);

        //Create Form and populate from database
        echo "Current Location";
        echo '<form action="results.php" method="get">';
        echo '<select name="Building">';
        while($building_array = mysql_fetch_array($building_query))
          {
          echo '<option value="'.$building_array["name"].'">'.$building_array["name"].'</option>';
          }
        echo "</select>";

        //Populate second select from database
        echo "<h5>Room:</h5>";
        echo '<select name="Room">';
        while($room_num_array=mysql_fetch_array($room_query))
          {
          echo '<option value="'.$room_num_array["number"].'">'.$room_num_array["number"].'</option>';
          }
        echo '</select>';
        echo '<br /><br />';

        echo '<INPUT TYPE="image" SRC="http://img.photobucket.com/albums/v627/lovkurama/button-1.png" width=100 ALT="Submit Form">';
        echo '</form>';

        mysql_close($link);


       ?>

        <br />



<br><br>


</body>
</html>
